package net.xju.controller;

import net.xju.common.framework.simplemvc.RequestMapping;
import net.xju.common.utils.JSONUtil;
import net.xju.common.utils.Result;
import net.xju.entity.CarouselImage;
import net.xju.service.CarouselImageService;
import net.xju.service.impl.CarouselImageServiceImpl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.List;

@RequestMapping("/api/carousel")
public class CarouselImageController {
    private CarouselImageService carouselImageService = new CarouselImageServiceImpl();

    @RequestMapping("/list.do")
    public void list(HttpServletRequest req, HttpServletResponse resp) throws UnsupportedEncodingException {
        List<CarouselImage> carouselImages = carouselImageService.list();
        JSONUtil.printByJSON(resp, Result.success(carouselImages));
    }
}